<?php

namespace app\api\controller;

use app\common\controller\Api;
use app\api\model\Banner;
use app\admin\model\general\Messages;
use app\admin\model\goods\Goods;

/**
 * 首页
 */
class Index extends Api
{

    // 无需登录的接口,*表示全部
    protected $noNeedLogin = ['index'];
    // 无需鉴权的接口,*表示全部
    protected $noNeedRight = ['*'];

    /**
     * 首页
     *
     * @ApiMethod (GET)
     */
    public function index()
    {
        //轮播图
        $data['banner'] = Banner::select();

        //公告
        $data['message'] = Messages::order('id', 'desc')->find();

        //商品
        $data['goods'] = Goods::where('is_recommend', 1)->where('status', 1)->select();

        $this->success('OK',$data);
    }
}
